<?php
/**
 * @author ykm 2016-01-25
 * @describe 电子面单请求数据处理公用类
 */

class ome_event_trigger_logistics_data_electron_common {
    public $channel;
    protected $directRet = array();
    protected $needRequestId = array();
    protected $needRequestDeliveryId = array();
    protected $needGetWBExtend = false;

    public function setChannel($channel) {
        $this->channel = $channel;
        return $this;
    }

    public function getDeliverySdf($delivery, $shop) {
        return false;
    }

    protected function getDeliveryOrder($deliveryId) {
        $db = kernel::database();
        $where = is_array($deliveryId) ? 'd.delivery_id in (' . (implode(',', $deliveryId)) . ')' : 'd.delivery_id = "' . $deliveryId .'"';
        $field = 'o.order_id, o.order_bn, o.total_amount, o.shop_id, o.createway, d.delivery_id';
        $sql = 'select '. $field . ' from sdb_ome_delivery_order as d left join sdb_ome_orders as o using(order_id) where ' . $where;
        $result = $db->select($sql);
        return $result;
    }

    //获取两条订单明细
    protected function getOrderItems($order_id) {
        static $orderItems = array();
        if (!$orderItems[$order_id]) {
            $orderItems[$order_id] = app::get('ome')->model('order_items')->getList('*', array('order_id' => $order_id), 0, 2);
        }
        return $orderItems[$order_id];
    }

    //获取两条发货单明细
    public function getDeliveryItems($delivery_id) {
        static $deliveryItems = array();
        if(!$deliveryItems[$delivery_id]) {
            $deliveryItems[$delivery_id] = app::get('ome')->model('delivery_items')->getList('*', array('delivery_id' => $delivery_id),0,2);
        }
        return $deliveryItems[$delivery_id];
    }

    
   

   

   

   
}